package org.example.server;

import org.example.command.OrderCmd;
import org.springframework.stereotype.Service;

import java.util.Comparator;
import java.util.List;

@Service
public class Sorter {

    public List<OrderCmd> sort(List<OrderCmd> cmds) {
        cmds.sort(
                Comparator.comparingLong(OrderCmd::getPrice)
                        .thenComparingLong(OrderCmd::getTimestamp)) ;
        return cmds;
    }
}
